<?
	require_once('../inc/users.php');
	$results = GetUsers();
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta charset="utf-8" />
		<title>Database Access</title>
        <link rel="stylesheet" type="text/css" href="../inc/bootstrap.css">
	</head>

	<body>
	
    <? include('../inc/header.php'); ?>
    <div class="container">
		<? include('../inc/nav.php'); ?>	
        <div id="contents">
        	
        	<? if(isset($_GET['inserted'])): ?>
        		<div class="alert">
        			<p>Record inserted successfully.</p>
        		</div>
        	<? endif; ?>
        	<a href="edit.php">Add a new user</a>
            <table class="table table-stripped table-bordered table-condensed table-hover">
                <tr>
                    <th>First Name</th><th>Last Name</th><th>Actions</th>
                </tr>
                <? while($rs = $results->fetch_assoc()):?>
                    <tr>
                        <td><?=$rs['FirstName']?></td>
                        <td><?=$rs['LastName']?></td>
                        <td>
                            <a href="details.php?id=<?=$rs['id']?>">Details</a>
                            <a href="edit.php?id=<?=$rs['id']?>">Edit</a>
                            <a href="delete.phpid=<?=$rs['id']?>">Delete</a>
                        </td>
                     </tr>
                <? endwhile; ?>
           </table>
       </div>
    </div>                
	</body>
</html>
<!--never change permanat state based of a get